<template>
  <el-menu
    :default-active="activeIndex"
    class="el-menu-demo"
    mode="horizontal"
    :ellipsis="false"
    @select="handleSelect"
  >
    <el-menu-item index="0">
      <el-avatar
        src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
      />
    </el-menu-item>
    <el-menu-item index="1"><router-link to="/home/index">首页</router-link></el-menu-item>
    <el-menu-item index="2"><router-link to="/home/study">学习</router-link></el-menu-item>
    <el-menu-item index="3"><router-link to="/home/homework">作业</router-link></el-menu-item>
    <el-menu-item index="4"><router-link to="/home/itemBank">题库</router-link></el-menu-item>
    <el-menu-item index="5">竞赛</el-menu-item>
    <div class="flex-grow" />
    <el-menu-item >
        <el-input  size="small"  placeholder="" :suffix-icon="Search">
        </el-input>
    </el-menu-item>
    <el-menu-item ><router-link to="/login">登录</router-link></el-menu-item>
    <el-menu-item>
      <IsDarkButton/>
    </el-menu-item>
    <el-sub-menu index="6">
      <template #title>设置</template>
      <el-menu-item index="2-1">账号信息</el-menu-item>
      <el-menu-item index="2-2">退出</el-menu-item> 
    </el-sub-menu>
  </el-menu>
</template>

<script lang="ts" setup>
import IsDarkButton from './IsDarkButton.vue';
import { ref } from 'vue'
import { Search } from '@element-plus/icons-vue'

const activeIndex = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}

</script>

<style>
.flex-grow {
  flex-grow: 1;
}
</style>
